package stack.era.domain.character;

import stack.era.constants.CharacterAttributes;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class CharacterTest extends TestCase {

	private Character playerCharacter;

	public CharacterTest(String name) {
		super(name);
	}

	protected void setUp() throws Exception {
		super.setUp();
		playerCharacter = new PlayerCharacter("Baknik");
	}

	protected void tearDown() throws Exception {
		super.tearDown();
		playerCharacter = null;
	}

	/**
	 * Tests that the getLevelForXP() method returns the appropriate level
	 * 
	 */
	public void testGetLevelForXP() {
		assertEquals(2, Character.getLevelForXP(16));
		assertEquals(40, Character.getLevelForXP(1314));
		assertEquals(1000, Character.getLevelForXP(CharacterAttributes.MAX_XP));
		assertEquals(1, Character.getLevelForXP(Integer.MIN_VALUE));
		assertEquals(1, Character.getLevelForXP(0));
		assertEquals(1, Character.getLevelForXP(-1));
		assertEquals(1, Character.getLevelForXP(1));
	}

	/**
	 * Creates a test suite for all Character object test cases
	 * 
	 * @return
	 */
	public static Test suite() {
		TestSuite suite = new TestSuite();
		suite.addTest(new CharacterTest("testGetLevelForXP"));
		return suite;
	}

}
